var xmlhttp

/************************************** FOR VALIDATING USERNAME START ********************/

function validateUsername(username)
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
  		{
  			alert ("Your browser does not support AJAX!");
  			return;
  		}
		var url="../include/ajax_files/validate_username.php";
		url=url+"?username="+username;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged_username;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}	

function stateChanged_username()
	{
		if (xmlhttp.readyState==4)
  		{
  			document.getElementById("username").innerHTML=xmlhttp.responseText;
  		}
	}
/************************************** FOR VALIDATING USERNAME END ********************/

/************************************** FOR VALIDATING EMAIL START ********************/

function validateEmail(email)
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
  		{
  			alert ("Your browser does not support AJAX!");
  			return;
  		}
		var url="../include/ajax_files/validate_email.php";
		url=url+"?email="+email;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged_email;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}	

function stateChanged_email()
	{
		if (xmlhttp.readyState==4)
  		{
  			document.getElementById("email").innerHTML=xmlhttp.responseText;
  		}
	}


/************************************** FOR VALIDATING EMAIL END ********************/

/************************************** FOR VALIDATING TYPE START ********************/

function validateType(type)
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
  		{
  			alert ("Your browser does not support AJAX!");
  			return;
  		}
		var url="../include/ajax_files/validate_type.php";
		url=url+"?type="+type;
		url=url+"&sid="+Math.random();
		xmlhttp.onreadystatechange=stateChanged_type;
		//alert(url);
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}	

function stateChanged_type()
	{
		if (xmlhttp.readyState==4)
  		{
  			document.getElementById("type").innerHTML=xmlhttp.responseText;
  		}
	}


/************************************** FOR VALIDATING TYPE END ********************/


/************************************** FOR VALIDATING DESCRIPTION START ********************/

function validateDescription(description)
	{
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
  		{
  			alert ("Your browser does not support AJAX!");
  			return;
  		}
		var url="../include/ajax_files/validate_description.php";
		url=url+"?description="+description;
		url=url+"&sid="+Math.random();
		//alert(url);
		xmlhttp.onreadystatechange=stateChanged_description;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}	

function stateChanged_description()// chk this out
	{
		if (xmlhttp.readyState==4)
  		{   //str="hello"
  			document.getElementById("description").innerHTML=xmlhttp.responseText;
  		}
	}


/************************************** FOR VALIDATING DESCRIPTION END ********************/










function GetXmlHttpObject()
	{
		if (window.XMLHttpRequest)
  		{
  			// code for IE7+, Firefox, Chrome, Opera, Safari
  			return new XMLHttpRequest();
  		}
		if (window.ActiveXObject)
  		{
  			// code for IE6, IE5
  			return new ActiveXObject("Microsoft.XMLHTTP");
  		}
		return null;
	}